/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ejb.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author simone
 */
@Entity
@Table(name = "Pacchetto_prenotato")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pacchettoprenotato.findAll", query = "SELECT p FROM Pacchettoprenotato p"),
    @NamedQuery(name = "Pacchettoprenotato.findByIdPackPrenotato", query = "SELECT p FROM Pacchettoprenotato p WHERE p.idPackPrenotato = :idPackPrenotato"),
    @NamedQuery(name = "Pacchettoprenotato.findPacchetto", query = "SELECT p FROM Pacchettoprenotato p WHERE p.fkPacchetto.idPacchetto = :idPacchetto"),
    @NamedQuery(name = "Pacchettoprenotato.findByUser", query = "SELECT p FROM Pacchettoprenotato p WHERE p.fkCliente.idCliente = :idCliente")})
public class Pacchettoprenotato implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_pack_prenotato")
    private Integer idPackPrenotato;
    @Basic(optional = false)
    @NotNull
    @Column(name = "date_dal")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateDal;
    @Basic(optional = false)
    @NotNull
    @Column(name = "date_al")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateAl;
    @Basic(optional = false)
    @NotNull
    @Column(name = "num_people")
    private int numPeople;  
    @JoinColumn(name = "fk_viaggio", referencedColumnName = "id_viaggio")
    @ManyToOne
    private Viaggio fkViaggio;
    @JoinColumn(name = "fk_pacchetto", referencedColumnName = "id_pacchetto")
    @ManyToOne
    private Pacchetto fkPacchetto;
    @JoinColumn(name = "fk_hotel", referencedColumnName = "id_hotel")
    @ManyToOne
    private Hotel fkHotel;
    @JoinColumn(name = "fk_escursione", referencedColumnName = "id_escursioni")
    @ManyToOne
    private Escursione fkEscursione;
    
    @JoinColumn(name = "fk_cliente", referencedColumnName = "id_cliente")
    @ManyToOne
    private Cliente fkCliente;

    public Pacchettoprenotato() {
    }


    public Pacchettoprenotato(Date dateDal, Date dateAl, int numPeople) {
        this.dateDal = dateDal;
        this.dateAl = dateAl;
        this.numPeople = numPeople;
    }

    public Integer getIdPackPrenotato() {
        return idPackPrenotato;
    }

    public void setIdPackPrenotato(Integer idPackPrenotato) {
        this.idPackPrenotato = idPackPrenotato;
    }

    public Date getDateDal() {
        return dateDal;
    }

    public void setDateDal(Date dateDal) {
        this.dateDal = dateDal;
    }

    public Date getDateAl() {
        return dateAl;
    }

    public void setDateAl(Date dateAl) {
        this.dateAl = dateAl;
    }

    public int getNumPeople() {
        return numPeople;
    }

    public void setNumPeople(int numPeople) {
        this.numPeople = numPeople;
    }

    public Viaggio getFkViaggio() {
        return fkViaggio;
    }

    public void setFkViaggio(Viaggio fkViaggio) {
        this.fkViaggio = fkViaggio;
    }

    public Pacchetto getFkPacchetto() {
        return fkPacchetto;
    }

    public void setFkPacchetto(Pacchetto fkPacchetto) {
        this.fkPacchetto = fkPacchetto;
    }

    public Hotel getFkHotel() {
        return fkHotel;
    }

    public void setFkHotel(Hotel fkHotel) {
        this.fkHotel = fkHotel;
    }

    public Escursione getFkEscursione() {
        return fkEscursione;
    }

    public void setFkEscursione(Escursione fkEscursione) {
        this.fkEscursione = fkEscursione;
    }

    public Cliente getFkCliente() {
        return fkCliente;
    }

    public void setFkCliente(Cliente fkCliente) {
        this.fkCliente = fkCliente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPackPrenotato != null ? idPackPrenotato.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pacchettoprenotato)) {
            return false;
        }
        Pacchettoprenotato other = (Pacchettoprenotato) object;
        if ((this.idPackPrenotato == null && other.idPackPrenotato != null) || (this.idPackPrenotato != null && !this.idPackPrenotato.equals(other.idPackPrenotato))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ejb.entities.Pacchettoprenotato[ idPackPrenotato=" + idPackPrenotato + " ]";
    }
    
}
